﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;

class BlueFairy : Missile
{
    float m_ContinueFireTime = 0.1f;
    float m_ContinueFireTimeCount = 0;
    int m_MultiFire = 0;
    GameObject m_MultiFireShip;
    Vector3 m_MultiFirePosition;
    Vector3 m_MultiFireDirection;
    public BlueFairy()
    {
        m_Price = 1600;
        m_Type = ItemsType.WEAPON_MIDDLE_KINETICS_BLUE_FAIRY;
        m_Speciality = Speciality.MAIN;
        ResearchInfluence = InfluenceMG.INFLUENCE_EARTH;
        ShutRange = 4;
        ShutVelocity = 8f;
        BulletFlyVelocity = 0.1f;
        Damage = 200;
        TurnSpeed = 80f;
        m_DropRate = 0.08f;
        m_ExplotionScale = 0.6f;

        m_Hp = 50;
        Name = "蓝精灵";
        Perview = "Textures/Weapon/WeaponMiddle/BlueFairy";
        WeaponResource = "Perfabs/Weapon/Middle/BlueFairy";
        BulletResource = "Perfabs/Bullet/BlueFairy";
        m_FireAudioResouce = "Perfabs/Audio/Chu";
        m_Level = Level.LEVEL_MIDDLE;
        Description = "它就静静的呆在哪里！直到有人踩了它一脚！";

    }
    public override FlyItem Fire(GameObject ship, WeaponSlot slot, Vector3 position, Vector3 direction)
    {
        if (ship)
            m_Ship = ship.GetComponent<Ship>();
        Slot = slot;
        var horizontalDir = Vector3.Cross(m_MultiFireDirection, new Vector3(0, 0, 1));
        var offset = horizontalDir * 0.1f;
        m_MultiFireShip = ship;
        m_MultiFirePosition = position;
        m_MultiFireDirection = direction;
        m_MultiFire = 3;
        m_ContinueFireTime = UnityEngine.Random.Range(0.3f, 0.6f);
        var flyItem = base.Fire(ship, slot, position + direction * (ShutRange -1), direction);
        FlyItemManager.Instance.RemoveFlyItem(flyItem);
        return flyItem;
    }


    public override int update()
    {
        base.update();
        return 1;
    }

}